package ca.concordia.soen6461.wichf.controller;

import java.util.HashMap;
import java.util.Map;

public abstract class Scope {

	private Map<Class<?>, Object> objects = new HashMap<Class<?>, Object>();
	
	public <T> void keep(T value) {
		objects.put(value.getClass(), value);
	}
	
	public <T> T drop(Class<T> type) {
		return type.cast(objects.remove(type));
	}
	
	public <T> T get(Class<T> type) {
		return type.cast(objects.get(type));
	}
	
}
